home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / Macintosh Programmer’s Workshop / MPW 3.1 / MPW / Interfaces / CIncludes / Picker.h < prev    next >
Text File  |  1990-12-13  |  3KB  |  88 lines

  1. /************************************************************
  2.  
  3. Created: Thursday, September 7, 1989 at 5:33 PM
  4.     Picker.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.     Copyright Apple Computer, Inc.    1987-1989
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PICKER__
  15. #define __PICKER__
  16.  
  17. #ifndef __QUICKDRAW__
  18. #include <Quickdraw.h>
  19. #endif
  20.  
  21. #define MaxSmallFract 0x0000FFFF    /*Maximum small fract value, as long*/
  22.  
  23.  
  24. /* A SmallFract value is just the fractional part of a Fixed number,
  25. which is the low order word.  SmallFracts are used to save room,
  26. and to be compatible with Quickdraw's RGBColor.  They can be
  27. assigned directly to and from INTEGERs. */
  28.  
  29. typedef unsigned short SmallFract;    /* Unsigned fraction between 0 and 1 */
  30.  
  31. /* For developmental simplicity in switching between the HLS and HSV
  32. models, HLS is reordered into HSL.    Thus both models start with
  33. hue and saturation values; value/lightness/brightness is last. */
  34.  
  35.  
  36.  
  37. struct HSVColor {
  38.     SmallFract hue;                 /*Fraction of circle, red at 0*/
  39.     SmallFract saturation;            /*0-1, 0 for gray, 1 for pure color*/
  40.     SmallFract value;                /*0-1, 0 for black, 1 for max intensity*/
  41. };
  42.  
  43. typedef struct HSVColor HSVColor;
  44. /* For developmental simplicity in switching between the HLS and HSVmodels, HLS
  45.  is reordered into HSL.  Thus both models start with hue and saturation values;
  46.  value/lightness/brightness is last. */
  47. struct HSLColor {
  48.     SmallFract hue;                 /*Fraction of circle, red at 0*/
  49.     SmallFract saturation;            /*0-1, 0 for gray, 1 for pure color*/
  50.     SmallFract lightness;            /*0-1, 0 for black, 1 for white*/
  51. };
  52.  
  53. typedef struct HSLColor HSLColor;
  54. struct CMYColor {
  55.     SmallFract cyan;
  56.     SmallFract magenta;
  57.     SmallFract yellow;
  58. };
  59.  
  60. typedef struct CMYColor CMYColor;
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64. pascal SmallFract Fix2SmallFract(Fixed f)
  65.     = {0x3F3C,0x0001,0xA82E};
  66. pascal Fixed SmallFract2Fix(SmallFract s)
  67.     = {0x3F3C,0x0002,0xA82E};
  68. pascal void CMY2RGB(const CMYColor *cColor,RGBColor *rColor)
  69.     = {0x3F3C,0x0003,0xA82E};
  70. pascal void RGB2CMY(const RGBColor *rColor,CMYColor *cColor)
  71.     = {0x3F3C,0x0004,0xA82E};
  72. pascal void HSL2RGB(const HSLColor *hColor,RGBColor *rColor)
  73.     = {0x3F3C,0x0005,0xA82E};
  74. pascal void RGB2HSL(const RGBColor *rColor,HSLColor *hColor)
  75.     = {0x3F3C,0x0006,0xA82E};
  76. pascal void HSV2RGB(const HSVColor *hColor,RGBColor *rColor)
  77.     = {0x3F3C,0x0007,0xA82E};
  78. pascal void RGB2HSV(const RGBColor *rColor,HSVColor *hColor)
  79.     = {0x3F3C,0x0008,0xA82E};
  80. pascal Boolean GetColor(Point where,const Str255 prompt,const RGBColor *inColor,
  81.     RGBColor *outColor)
  82.     = {0x3F3C,0x0009,0xA82E};
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86.  
  87. #endif
  88.